﻿using System.Windows;
using BaseTypesControlLib.Interfaces;

namespace BaseTypesControlLib.Controls
{
    public class CheckBoxFieldControl : ButtonFieldControl, IUseAllWidth
    {
        public CheckBoxFieldControl()
        {
            DefaultStyleKey = typeof(CheckBoxFieldControl);
        }
        static CheckBoxFieldControl()
        {
            FrameworkPropertyMetadata fpm = new FrameworkPropertyMetadata(false,
                FrameworkPropertyMetadataOptions.AffectsMeasure |
                FrameworkPropertyMetadataOptions.AffectsArrange);
            UseAllWidthProperty = DependencyProperty.Register("UseAllWidth", typeof(bool),
                typeof(CheckBoxFieldControl), fpm);

            fpm = new FrameworkPropertyMetadata(false,
                FrameworkPropertyMetadataOptions.AffectsMeasure |
                FrameworkPropertyMetadataOptions.AffectsArrange);
            CheckedProperty = DependencyProperty.Register("Checked", typeof(bool),
                typeof(CheckBoxFieldControl), fpm);
        }

        public bool UseAllWidth
        {
            get { return (bool)GetValue(UseAllWidthProperty); }
            set { SetValue(UseAllWidthProperty, value); }
        }
        public static readonly DependencyProperty UseAllWidthProperty;

        public bool Checked
        {
            get { return (bool)GetValue(CheckedProperty); }
            set { SetValue(CheckedProperty, value); }
        }
        public static readonly DependencyProperty CheckedProperty;
    }
}
